package com.bsp.autobean;

import org.springframework.boot.web.servlet.ErrorPage;
import org.springframework.boot.web.servlet.ErrorPageRegistrar;
import org.springframework.boot.web.servlet.ErrorPageRegistry;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

/**
 * 注册错误页面
 * Created by zyf on 2017/5/12 0012.
 */
@Component
public class CommonErrorPageRegistrar implements ErrorPageRegistrar {
    @Override
    public void  registerErrorPages(ErrorPageRegistry registry){
        ErrorPage error404 = new ErrorPage(HttpStatus.NOT_FOUND, "/error_page/404.html");
        ErrorPage error500 = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error_page/500.html");
        registry.addErrorPages(error404, error500);
    }
}
